﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DisplayReadingClient
{
    /// <summary>
    /// 图片绘制
    /// </summary>
    public class picview : IDrawable
    {
       public  Microsoft.Maui.Graphics.IImage[] bitmaps=null;
        public void Draw(ICanvas canvas, RectF dirtyRect)
        {
            if (bitmaps==null)
            {
                return;
            }
            float width = 0;
            float height = 0;

            foreach (var bitmap in bitmaps)
            {
                if (bitmap == null)
                {
                    continue;
                }
                height += bitmap.Height;
                width = bitmap.Width;
            }
            if (width == 0 || height == 0)
            {
                return;
            }
            for (Int32 i = 0; i < bitmaps.Length; i++)
            {
                if (bitmaps[i] == null)
                {
                    continue;
                }
                canvas.DrawImage(bitmaps[i], 0, height, bitmaps[i].Width, bitmaps[i].Height);
                height += bitmaps[i].Height;
            }
        }
    }
}
